#include < iostream >
#include < windows.h >




bool InjectDLL(HANDLE handle, const char* pathOfDLL)
{
	void *Lib, *Str;
	Lib = (void*)(LoadLibraryA);
	Str = (void*)VirtualAllocEx(handle, NULL, strlen(pathOfDLL), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
	WriteProcessMemory(handle, (void*)Str, pathOfDLL, strlen(pathOfDLL), NULL);
	CreateRemoteThread(handle, NULL, NULL, (LPTHREAD_START_ROUTINE)Lib, (void*)Str, NULL, NULL);
	return true;
}

int main(int ArgCount, char** Args)
{
	STARTUPINFO                     startupInfo;
	PROCESS_INFORMATION     processInfo;

	memset(&startupInfo, 0x00, sizeof(STARTUPINFO));
	memset(&processInfo, 0x00, sizeof(PROCESS_INFORMATION));

	startupInfo.cb = sizeof(STARTUPINFO);

	if (CreateProcess(L"./TheEscapists.exe", L"", NULL, NULL, true, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &startupInfo, &processInfo) == false)
	{
		std::cout << "Lancement de \"TheEscapists.exe\" echoue ..." << std::endl;
		system("pause");
		return 0;
	}

	InjectDLL(processInfo.hProcess, "TheEscapists.dll");
	return 0;
}
